<template>
  <div class="container">
    <button class="btn">copy</button>
  </div>
</template>

<script>
import ClipboardJS from 'clipboard'
import { Toast } from 'vant'

export default {
  mounted() {
    let clipboard = new ClipboardJS('.btn', {
      text: () => {
        return 'well done'
      }
    })
    clipboard.on('success', e => {
      Toast('复制成功')
      e.clearSelection()
    })
  },
}
</script>

<style scoped>

</style>